package com.smartcruise.report;

import android.content.Context;
import android.content.Intent;
import android.widget.ImageView;

import com.smartcruise.R;
import com.smartcruise.base.BaseTitleActivity;
import com.smartcruise.base.TitleBuilder;
import com.smartcruise.util.IntentUtils;
import com.smartcruise.util.image.MyGlide;

import butterknife.BindView;

/**
 * Created by FengChaoQun
 * on 2018/1/24 0024
 * 展示图片
 */

public class ShowImageActivity extends BaseTitleActivity {

    @BindView(R.id.imageView)
    ImageView imageView;
    private String imagePath;

    public static void start(Context context, String dataPath) {
        Intent intent = new Intent(context, ShowImageActivity.class);
        intent.putExtra(IntentUtils.DATA, dataPath);
        context.startActivity(intent);
    }

    @Override
    protected void init() {

        setEnableRightSlide(false);

        imagePath = getIntent().getStringExtra(IntentUtils.DATA);
        if (imagePath == null) {
            showToast(getString(R.string.noDataFined));
            finish();
            return;
        }

        MyGlide.with(getActivity(), imagePath, imageView);
    }

    @Override
    protected int getContentLayout() {
        return R.layout.activity_show_image;
    }

    @Override
    protected TitleBuilder getTitleBuilder() {
        return TitleBuilder.create(true, getString(R.string.preview));
    }

}
